package org.kaer.election.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class Candidate  implements Parcelable{
	public int candidateId = 0;
	public int voterId = 0;
	public int candidateTimes = 0;
	public int getVotes = 0;
	private int positionId = 0;

	private String positionName;
	public String voterName; // 候选人姓名
	public String voterAddress;// "候选人住址"
	public String voterCertNumber;// 候选人身份证号
	public String voterPicture;// "候选人照片base64编码",
	public String voterPolitical;// "政治成分"
	public String voterRemark;// 备注信息
	public String voterGender; //候选人性别
	public int posIndex=-1; //选中职位的索引

	public int getPositionId() {
		return positionId;
	}

	public void setPositionId(int positionId) {
		this.positionId = positionId;
	}

	public String getPositionName() {
		return positionName;
	}

	public void setPositionName(String positionName) {
		this.positionName = positionName;
	}

	protected Candidate(Parcel in) {
		candidateId = in.readInt();
		voterId = in.readInt();
		candidateTimes = in.readInt();
		getVotes = in.readInt();
		positionId = in.readInt();
		positionName = in.readString();
		voterName = in.readString();
		voterAddress = in.readString();
		voterCertNumber = in.readString();
		voterPicture = in.readString();
		voterPolitical = in.readString();
		voterRemark = in.readString();
		voterGender = in.readString();
		posIndex = in.readInt();
	}

	public static final Creator<Candidate> CREATOR = new Creator<Candidate>() {
		@Override
		public Candidate createFromParcel(Parcel in) {
			return new Candidate(in);
		}

		@Override
		public Candidate[] newArray(int size) {
			return new Candidate[size];
		}
	};

	@Override
	public String toString() {
		return "Candidate{" +
				"candidateId=" + candidateId +
				", voterId=" + voterId +
				", candidateTimes=" + candidateTimes +
				", getVotes=" + getVotes +
				", positionId=" + positionId +
				", positionName='" + positionName + '\'' +
				", voterName='" + voterName + '\'' +
				", voterAddress='" + voterAddress + '\'' +
				", voterCertNumber='" + voterCertNumber + '\'' +
				/*", voterPicture='" + voterPicture + '\'' +*/
				", voterPolitical='" + voterPolitical + '\'' +
				", voterRemark='" + voterRemark + '\'' +
				", voterGender='" + voterGender + '\'' +
				", posIndex=" + posIndex +
				'}';
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(candidateId);
		dest.writeInt(voterId);
		dest.writeInt(candidateTimes);
		dest.writeInt(getVotes);
		dest.writeInt(positionId);
		dest.writeString(positionName);
		dest.writeString(voterName);
		dest.writeString(voterAddress);
		dest.writeString(voterCertNumber);
		dest.writeString(voterPicture);
		dest.writeString(voterPolitical);
		dest.writeString(voterRemark);
		dest.writeString(voterGender);
		dest.writeInt(posIndex);
	}
}
